<?php
// +----------------------------------------------------------------------
// | Yzncms [ 御宅男工作室 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://yzncms.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 御宅男 <530765310@qq.com>
// +----------------------------------------------------------------------

// +----------------------------------------------------------------------
// | 用户自定义函数库
// +----------------------------------------------------------------------

//加解密秘钥
const ENCRYPT_KEY = 'aadc%RG6CCCcnlksdjflS3454f;lkjdsl';
//设置固定的16个字节
const ENCRYPT_IV = 'ivpassedsd09fdsf';
/**
 * 加密
 * @param string $data
 * @return false|string
 */
function encryptData(string $data)
{
    return openssl_encrypt($data, 'AES-256-CBC', ENCRYPT_KEY, 0, ENCRYPT_IV);
}

/**
 * 解密数据
 * @param string $encryptData
 * @return false|string
 */
function decryptData(string $encryptData)
{
    return openssl_decrypt($encryptData, 'AES-256-CBC', ENCRYPT_KEY, 0, ENCRYPT_IV);
}

/**
 * 生成前端退款url
 * @param $id
 * @return string
 */
function createCodeUrl($id)
{
    return request()->domain(true) . '/refund/#/code/' . $id;
}